/**
 * Created by VIETBINH on 11/24/14.
 */
myApp.controller('Product', function ($scope, $ionicModal) {

        $scope.data = {
            showDelete: false
        };
        $scope.moveItem = function (item, fromIndex, toIndex) {
            $scope.items.splice(fromIndex, 1);
            $scope.items.splice(toIndex, 0, item);
        };

        $scope.onItemDelete = function (item) {
            $scope.items.splice($scope.items.indexOf(item), 1);
        };

        $ionicModal.fromTemplateUrl('templates/add_product.html', {
            animation: 'slide-in-up',
            scope: $scope
        }).then(function (modal) {
                $scope.modal = modal;
            });


        $scope.AddProduct = function () {
            $scope.data = {}
            $scope.modal.show();
        }
        $scope.items = [
            { id: 0, name_product: "C2"},
            { id: 1, name_product: "Khoáng ng?t"},
            { id: 2, name_product: "Khoáng m?n"},
            { id: 3, name_product: "Cafe ???ng"},
            { id: 4, name_product: "Cafe s?a"}
        ];

    });